import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../components/home.vue'
import HomePage from '../components/homepage.vue'
import Archive from '../components/archive.vue'
import Type from '../components/type.vue'
import Tag from '../components/tag.vue'
import Message from '../components/message.vue'
import Introduce from '../components/introduce.vue'
import Essay from '../components/essay.vue'
import BlogDetails from '../components/BlogDetails.vue'
import SearchList from '../components/search/SearchList.vue'
import FriendSite from '../components/friendsite.vue'

Vue.use(VueRouter)

const routes = [
  { path: '/', redirect: '/home' },
  {
    path: '/home',
    component: Home,
    redirect: '/homepage',
    children: [
      { path: '/homepage', component: HomePage },
      { path: '/archive', component: Archive },
      { path: '/type', component: Type },
      { path: '/tag', component: Tag },
      { path: '/message', component: Message },
      { path: '/introduce', component: Introduce },
      { path: '/essay', component: Essay },
      { path: '/article/:id', component: BlogDetails },
      { path: '/searchlist/keyword/:keyword', name: 'searchlist', component: SearchList },
      { path: '/friend', component: FriendSite }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  routes
})

export default router
